<html>
<body>
<canvas id="canvas" width="600" height="100" ></canvas>
<script>
var canvas = document.createElement("canvas");
canvas.width = canvas.height = 100;
var context = canvas.getContext("2d");
context.fillStyle = 'green';
context.fillRect(0, 0, 100, 100);
var canvas2 = document.createElement("canvas");
var context2 = canvas2.getContext("2d");
var drawCanvas = document.getElementById("canvas");
var drawCtx = drawCanvas.getContext("2d");

context2.globalAlpha = 0.0;
context2.drawImage(canvas, 0, 0);
drawCtx.drawImage(canvas2, 0, 0, 100, 100, 0, 0, 100, 100);

context2.globalAlpha = 0.2;
context2.drawImage(canvas, 0, 0);
drawCtx.drawImage(canvas2, 0, 0, 100, 100, 100, 0, 100, 100);

context2.globalAlpha = 0.4;
context2.drawImage(canvas, 0, 0);
drawCtx.drawImage(canvas2, 0, 0, 100, 100, 200, 0, 100, 100);

context2.globalAlpha = 0.6;
context2.drawImage(canvas, 0, 0);
drawCtx.drawImage(canvas2, 0, 0, 100, 100, 300, 0, 100, 100);

context2.globalAlpha = 0.8;
context2.drawImage(canvas, 0, 0);
drawCtx.drawImage(canvas2, 0, 0, 100, 100, 400, 0, 100, 100);

context2.globalAlpha = 1.0;
context2.drawImage(canvas, 0, 0);
drawCtx.drawImage(canvas2, 0, 0, 100, 100, 500, 0, 100, 100);
</script>
</body>
</html>
